RegWriteStringValue

Prototype:

function RegWriteStringValue(const RootKey: Integer; const SubKeyName, ValueName, Data: String): Boolean;

Description:

Writes the specified REG_SZ-type registry value. Returns True if successful, False otherwise.

Remarks:

If the value already exists and is of type REG_EXPAND_SZ, the new value will also be of type REG_EXPAND_SZ. Otherwise, a REG_SZ-type value will be created.

Example:
begin
  RegWriteStringValue(HKEY_CURRENT_USER, 'Software\My Company\My Program',
    'UserName', ExpandConstant('{sysuserinfoname}'));
end;